package tianrun.ziguan.api.calculate.config.service.asset.instance.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tianrun.ziguan.api.calculate.config.dao.TAssetEdgeInputInstanceMapper;
import tianrun.ziguan.api.calculate.config.dto.request.AssetEdgeInputInstanceVO;
import tianrun.ziguan.api.calculate.config.entity.TAssetEdgeInputInstance;
import tianrun.ziguan.api.calculate.config.service.asset.instance.ITAssetEdgeInputInstanceService;
import tianrun.ziguan.api.calculate.config.utils.CollectionUtil;

import java.util.Collections;
import java.util.List;
import java.util.Set;

@Service
public class TTAssetEdgeInputInstanceServiceImpl extends ServiceImpl<TAssetEdgeInputInstanceMapper, TAssetEdgeInputInstance> implements ITAssetEdgeInputInstanceService {
    @Override
    public List<TAssetEdgeInputInstance> listByModuleIds(Set<Long> ids) {
        if (CollectionUtil.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return list(Wrappers.<TAssetEdgeInputInstance>lambdaQuery().in(TAssetEdgeInputInstance::getModuleId, ids));
    }

    @Override
    public List<AssetEdgeInputInstanceVO> listVOByCalAssetIds(Set<Long> ids) {
        if (CollectionUtil.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return baseMapper.listByCalAssetIds(ids);
    }
    @Override
    public List<AssetEdgeInputInstanceVO> listVOByAssetNums(Set<String> assetNums) {
        if (CollectionUtil.isEmpty(assetNums)) {
            return Collections.emptyList();
        }
        return baseMapper.listByAssetNums(assetNums);
    }
}
